class AddIndexes < ActiveRecord::Migration
  def self.up
    add_index :users, :team_id

    add_index :tasks, [:begin_at, :end_at]

    add_index :periods, [:task_id, :begin_at, :end_at]
    add_index :periods, [:user_id, :begin_at, :end_at]
  end

  def self.down
    remove_index :users, :team_id

    remove_index :tasks, :column => [:begin_at, :end_at]

    remove_index :periods, :column => [:begin_at, :end_at]
    remove_index :periods, :column => [:user_id, :begin_at, :end_at]
  end
end
